// 快速排序

function quickSort(array){
    if(array.length <= 1) {
        return array;
    }
    let left = [];
    let right = [];
    let pivotIndex = Math.floor(array.length / 2);
    let pivotIndexValue = array.splice(pivotIndex, 1);
    for(let i = 0; i < array.length; i++) {
        if(array[i] < pivotIndexValue) {
            left.push(array[i]);
        } else {
            right.push(array[i]);
        }
    }
    return quickSort(left).concat([pivotIndexValue], quickSort(right));

}